﻿

namespace System.Extensions
{
  using System;

  /// <summary>
  /// Extension methods for a <see cref="DateTime"/>.
  /// </summary>
  public static class DateTimeExtensions
  {
    /// <summary>
    /// Indicates whether the specified <see cref="DateTime"/> is on a weekend day.
    /// </summary>
    /// <param name="dateTime">The <see cref="DateTime"/> to check.</param>
    /// <returns><b>True</b> if the day represented is a weekend day; <b>false</b> otherwise.</returns>
    public static bool IsWeekend(this DateTime dateTime)
    {
      return dateTime.DayOfWeek == DayOfWeek.Saturday || dateTime.DayOfWeek == DayOfWeek.Sunday;
    }

    /// <summary>
    /// Indicates whether the specified <see cref="DateTime"/> occurs on a week day.
    /// </summary>
    /// <param name="dateTime">The <see cref="DateTime"/> to check.</param>
    /// <returns><b>True</b> if the day represented is a week day; <b>false</b> otherwise.</returns>
    public static bool IsWeekday(this DateTime dateTime)
    {
      return !IsWeekend(dateTime);
    }
  }
}
